package com.ymatou.iapi.userservice.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.userservice.parameter.CheckMobileIsBindYmatouUserDtoBean;
import com.ymatou.iapi.userservice.parameter.UnBindMobileRequestDtoBean;
import com.ymatou.iapi.userservice.parameter.req.CreateUserReq;
import com.ymatou.iapi.userservice.service.CheckMobileIsBindYmatouUserDtoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.utils.TestDataManager;
/**
*查询手机是否绑定了码头账号Test
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_CheckMobileIsBindYmatouUserDto{
	private static CheckMobileIsBindYmatouUserDtoBean checkmobileisbindymatouuserdtoBean;
	private static CheckMobileIsBindYmatouUserDtoCall checkmobileisbindymatouuserdtoCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询手机是否绑定了码头账号Test");
	}

	@Before
	public void caseUp() {
		checkmobileisbindymatouuserdtoBean=new CheckMobileIsBindYmatouUserDtoBean();
		checkmobileisbindymatouuserdtoCall=new CheckMobileIsBindYmatouUserDtoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(checkmobileisbindymatouuserdtoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CheckMobileIsBindYmatouUserDto_001() {
		Logger.start(true,"查询手机是否绑定了码头账号,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			
			checkmobileisbindymatouuserdtoBean.setMobile(cur.getMobile());
			checkmobileisbindymatouuserdtoCall.setData(checkmobileisbindymatouuserdtoBean);
			checkmobileisbindymatouuserdtoCall.callService();			
			Logger.verifyEquals("true", checkmobileisbindymatouuserdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", checkmobileisbindymatouuserdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyEquals("yes", checkmobileisbindymatouuserdtoCall.getString("Result"), "验证Result");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CheckMobileIsBindYmatouUserDto_002() {
		Logger.start(true,"查询未绑定手机是否绑定了码头账号,成功");
		try {
			checkmobileisbindymatouuserdtoBean.setMobile(TestDataManager.getPhoneNum());
			checkmobileisbindymatouuserdtoCall.setData(checkmobileisbindymatouuserdtoBean);
			checkmobileisbindymatouuserdtoCall.callService();			
			Logger.verifyEquals("true", checkmobileisbindymatouuserdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", checkmobileisbindymatouuserdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyEquals("no", checkmobileisbindymatouuserdtoCall.getString("Result"), "验证Result");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CheckMobileIsBindYmatouUserDto_003() {
		Logger.start(false,"不输入mobile,失败");
		try {
			checkmobileisbindymatouuserdtoCall.setData(checkmobileisbindymatouuserdtoBean);
			checkmobileisbindymatouuserdtoCall.callService();			
			Logger.verifyEquals("false", checkmobileisbindymatouuserdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("400", checkmobileisbindymatouuserdtoCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_CheckMobileIsBindYmatouUserDto_004() {
		Logger.start(true,"解绑手机是否绑定了码头账号,成功");
		try {
			CreateUserReq cur = new CreateUserReq();
			cur = JUserCallService.initCreateUserBean(cur);
			Integer uid = JUserCallService.createUserCall(cur);
			UnBindMobileRequestDtoBean ub=new UnBindMobileRequestDtoBean();
			ub.setMobile(cur.getMobile());
			ub.setUserId(uid);
			JUserCallService.UnBindMobileCall(ub);
			checkmobileisbindymatouuserdtoBean.setMobile(cur.getMobile());
			checkmobileisbindymatouuserdtoCall.setData(checkmobileisbindymatouuserdtoBean);
			checkmobileisbindymatouuserdtoCall.callService();			
			Logger.verifyEquals("true", checkmobileisbindymatouuserdtoCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", checkmobileisbindymatouuserdtoCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyEquals("no", checkmobileisbindymatouuserdtoCall.getString("Result"), "验证Result");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}